<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="author" content="李愧愧">
    <title></title>
    <style>
        div{
            width: 200px;
            height: 200px;
            border: 10px solid black;
            background-color: black;
            color: white;
            padding: 10px;
        }
    </style>
</head>
<body>
    <div>  
        鼠标移入改变样式,鼠标移出恢复
    </div>
<script>
    
    var div =document.querySelector('div');
    div.onmousemove = function(){
        div.style='border: 10px solid red;background-color: white;color: red;'
    }
    div.onmouseleave = function(){
        div.style.cssText='';
    }

</script>
</body>
</html>